Fix improperly unwinded loops
authorTadej Borovšak <tadeboro@gmail.com>
Fri, 6 Aug 2010 23:58:29 +0000 (01:58 +0200)
committerTristan Van Berkom <tristan.van.berkom@gmail.com>
Sat, 7 Aug 2010 00:08:32 +0000 (20:08 -0400)
gtk/gtkbox.c

index be089009d263860da0ff330a249b98b861cdb60d..cdc5f1d46fac689c8e158a9ef0b90ffdb7343ab0 100644 (file)
@@ -542,12 +542,19 @@ gtk_box_size_allocate (GtkWidget     *widget,
        {
          child = children->data;
 
-         /* If widget is not visible or it's packing is not right for current
-          * loop, skip it.
-          */
-         if (child->pack != packing || !gtk_widget_get_visible (child->widget))
+         /* If widget is not visible, skip it. */
+         if (!gtk_widget_get_visible (child->widget))
            continue;
 
+         /* If widget is packed differently skip it, but still increment i,
+          * since widget is visible and will be handled in next loop iteration.
+          */
+         if (child->pack != packing)
+           {
+             i++;
+             continue;
+           }
+
          /* Assign the child's size. */
          if (private->homogeneous)
            {
@@ -1020,9 +1027,19 @@ gtk_box_compute_size_for_opposing_orientation (GtkBox *box,
        {
          child = children->data;
 
-         if (child->pack != packing || !gtk_widget_get_visible (child->widget))
+         /* If widget is not visible, skip it. */
+         if (!gtk_widget_get_visible (child->widget))
            continue;
 
+         /* If widget is packed differently skip it, but still increment i,
+          * since widget is visible and will be handled in next loop iteration.
+          */
+         if (child->pack != packing)
+           {
+             i++;
+             continue;
+           }
+
          if (child->pack == packing)
            {
              /* Assign the child's size. */